-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add context to signature mangling errors #95
Conversation
As an FYI: we accidentally had duplicate sections and they should have just been fixed, but without this patch it's hard to figure out where. |
numpydoc/numpydoc.py
Outdated
try: | ||
doc = SphinxDocString(pydoc.getdoc(obj)) | ||
except ValueError as e: | ||
filename = obj.__code__.co_filename |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's Python 3 only, needs to be:
try:
filename = inspect.getsourcefile(obj)
except TypeError:
filename = None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the full object name should in principle contained in name
--- does it get shown by Sphinx?
d3f2c91
to
46036b0
Compare
@pv thanks, I now put the fix in the right place and made this much less hacky. That allowed me to add a test. |
thanks lgtm |
This is slightly hacky (again) but hopefully also useful.
I ran into #67 in scikit-learn, but there was no info whatsoever where this came from. Now it gives the object name and file, so I could actually fix it. Even if #67 gets merged, there is still an error about the having yield and return which would have no context. If that is also removed then this code is not needed any more.